package com.example.easyscript.dto.Resp;

import cn.hutool.extra.cglib.CglibUtil;
import com.example.easyscript.bean.task.OperationBean;
import com.example.easyscript.bean.task.TaskBean;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;
import java.util.stream.Collectors;

@Data
public class RunningTaskInfo {
    private Integer taskId;
    private String taskName;
    private String windowsName;
    @ApiModelProperty("需要执行的操作列表")
    private List<OperationBean> operationQue;
    @ApiModelProperty("任务描述")
    private String taskDesc;
    @ApiModelProperty("操作列表")
    private List<OperationBean> operationBeanList;

    public RunningTaskInfo(){

    }

    public RunningTaskInfo(TaskBean taskBean) {
        CglibUtil.copy(taskBean, this);
        operationQue = taskBean.getOperationQue();
        operationBeanList = taskBean.getOperationBeanMap().values().stream().collect(Collectors.toList());
        taskId = taskBean.getId();
    }
}
